[Top] [Prev] [Next] [Bottom] [Contents]

SaMakeCbsColList

Makes an SaCallbackStruct from a list of columns in an SaCallbackStruct callback structure.

Synopsis

#include "SaPopCalls.h"
SaCallbackStruct* SaMakeCbsColList(SaCallbackStruct *cbs,
						pSutList 
colList);

Arguments

cbs
SaCallbackStruct callback structure
colList
Specifies which columns to use when making the return SaCallbackStruct

Return Values

An SaCallbackStruct containing the data from a list of columns in an SaCallbackStruct. A NULL pointer is returned if cbs is NULL or if the column specification is invalid.

Description

SaMakeCbsByCol returns a malloc'd SaCallbackStruct given a callback structure.

The colList parameter specifies which columns from the first group in cbs to use when making the return SaCallbackStruct.

If cbs is NULL, colList is NULL, or colList is an empty list, a NULL pointer is returned.

Use SaFreeCbs() to deallocate the returned SaCallbackStruct when it is no longer needed.

The returned SaCallbackStruct structure should be considered read-only data. Also, the actual data values in the structure should only be used while the underlying data is valid. This is usually after the Population callback function returns, although it may extend beyond that if the data is cached and not overwritten.

The colList must be assembled using:

list = SutNewList();
Followed by:

SutAddList(list, (void *)i);
Where list is a pSutList and i is an integer value representing a column in an SaCallbackStruct.

SutAddList should be called once for each column to be returned in the SaCallbackStruct. Columns can be re-ordered by changing their order in the pSutList.

To free the pSutList use SutDeleteList, not SutDestroyList!

There are many functions to support SutLists which are listed in See Also.

Example

#include "SaConsoleCalls.h"
void MyPopulateList(wid)
	Widget wid;
{
	pSutList colList;
	SaCallbackStruct *cbs, *lcbs;
	char *stmt = "select * from titles";

	cbs = SaExecSQL("SYBASE", "pubs2", SGESYBASE, stmt);
	list = SutNewList();
	SutAddList(list, (void *)2);						/* put col 2 first */
	SutAddList(list, (void *)1);						/* put col 1 next */
	SutAddList(list, (void *)0);						/* put col 0 next */
	SutAddList(list, (void *)6);						/* put col 6 last */
	lcbs = SaMakeCbsColList(cbs, list);
	SutDeleteList(list);
	SaPopulateList(wid, lcbs, NULL);
	SaFreeCbs(lcbs); SaFreeCbs(cbs);
}

See Also



[Top] [Prev] [Next] [Bottom] [Contents]

info@bluestone.com
Copyright © 1997, Bluestone. All rights reserved.